package zetcode.sprites;

import java.awt.Image;
import java.awt.Rectangle;
import javax.swing.ImageIcon;

public class Alien {
	private String pictureFilePath = "/pics/alien.png";
	
	private int x, y;
	private int width, height;
	private boolean visible;
	private Image image;
	
	public Alien(int x, int y){
		ImageIcon ii = new ImageIcon(this.getClass().getResource(pictureFilePath));
		image = ii.getImage();
		
		width = image.getWidth(null);
		height = image.getHeight(null);
		visible = true;
		this.x = x;
		this.y = y;
	}
	
	public void move(){
		if(x < 0){x = 400;}
		x -= 1;
	}
	
	public int getX(){return x;}
	public int getY(){return y;}
	public boolean isVisible(){return visible;}
	public Image getImage(){return image;}
	public Rectangle getBounds(){return new Rectangle(x, y, width, height);}
	
	public void setVisible(boolean visible){this.visible = visible;}
}
